package com.nimt.hqgl_idea.controller;

import com.nimt.hqgl_idea.entity.Order;
import com.nimt.hqgl_idea.param.OrderParam;
import com.nimt.hqgl_idea.service.OrderService;
import com.nimt.hqgl_idea.util.ResponseBody;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@CrossOrigin/*跨域*/
@RestController/*controller组件*/
@RequestMapping("/order")/*地址*/
public class OrderController {
    @Autowired
    OrderService orderService;

    @PostMapping("/add")
    public ResponseBody add(Order order){
        return orderService.add(order);
    }

    @GetMapping("/query")
    public ResponseBody query(OrderParam orderParam){
        return orderService.query(orderParam);
    }

    @PostMapping("/state")
    public ResponseBody state(Integer id){
        return orderService.state(id);
    }

    @PostMapping("/del")
    public ResponseBody del(Integer id){
        return orderService.del(id);
    }
}
